<extend name="./public/frame.html"/>
<block name="content">
	<blockquote class="layui-elem-quote search">
		<div class="layui-inline">
			<select id="all_phone" class="layui-input" style="width: 100px;">
				<option value="">全部司机</option>
				<option value="1">普通司机</option>
				<option value="2">测试司机</option>
			</select>
		</div>
		<div class="layui-inline">
			<input type="text" class="layui-input date" readonly id="start" placeholder="封禁开始时间" style="width: 100px;">
		</div>
		<div class="layui-inline">
			<input type="text" class="layui-input date" readonly id="end" placeholder="封禁结束时间" style="width: 100px;">
		</div>

		<div class="layui-inline">
			<select name="province_id" id="province_id" class="layui-input" lay-filter="province" style="width: 120px;" onclick="getProvinceList();">
				<option value="">请选择省份</option>
				<?php foreach($provinceList as $key=>$value):?>
				<option value="<?php echo $value['region_id'];?>"><?php echo $value['region_name'];?></option>
				<?php endforeach;?>
			</select>
		</div>
		<div class="layui-inline">
			<select name="city_id" id="city_id" class="layui-input" lay-filter="city_id" style="width: 120px;">
				<option value="">请选择城市</option>
			</select>
		</div>

		<div class="layui-inline">
			<input type="text" lay-verify="required|title" required placeholder="请输入手机号" class="layui-input" id="driver_phone" style="width: 120px;">
		</div>

		<div class="layui-inline">
			<button class="layui-btn" data-type="search">搜索</button>
<!--			<button class="layui-btn layui-btn-warm" data-type="excel">导出</button>-->
<!--            <button class="layui-btn layui-btn-warm" data-url="{:url('onlineList')}" onclick="add_t(this,'在线记录')">-->
<!--                在线记录-->
<!--            </button>-->
<!--			<a class="layui-btn layui-btn-warm " lay-event="distribute" data-url="{:url('batch_distribute')}" onclick="add_t(this,'司机分配-快车租赁公司')">分配</a>-->
		</div>
		<br/><br/>
	</blockquote>
	<table class="layui-table" lay-data="{width:'auto', height:'auto', url:'{:url('Driver/banned')}', page: true, limit: 10, id:'driver'}" lay-filter="driver">
		<thead>
			<tr>
				<th lay-data="{field:'driver_id', width:70,fixed: true, sort: true,align:'center',fixed: true}">ID</th>
				<th lay-data="{field:'driver_name', width:90,align:'center'}">司机姓名</th>
				<th lay-data="{field:'driver_phone', width:120,align:'center',templet:'#statusTpl'}">手机号码</th>
				<th lay-data="{field:'provinceCity', width:140,align:'center'}">认证城市</th>
				<th lay-data="{field:'complaintNum', width:100,align:'center'}">投诉次数</th>
				<th lay-data="{field:'forbid', width:100,align:'center'}">封禁类型</th>
				<th lay-data="{field:'forbid_content', width:550,align:'center'}">封禁原因</th>
				<th lay-data="{field:'forbid_time_start', width:200,align:'center'}">封禁开始时间</th>
				<th lay-data="{field:'forbid_time_end', width:200,align:'center'}">封禁结束时间</th>
			</tr>
		</thead>
	</table>
	<script type="text/html" id="statusTpl">
		{{#if(d.driver_type_status == 1) { }}
		<span style="color: red">{{d.driver_phone}}</span>
		{{# } else { }}
		{{d.driver_phone}}
		{{#}}}
	</script>

	<script type="application/javascript">
		layui.use(['table', 'form', 'laydate'], function () {
			var table = layui.table
				, form = layui.form
				, laydate = layui.laydate;
			lay('.date').each(function(){
				laydate.render({
					elem: this
					,type: 'date'
					,trigger: 'click'
				});
			});

			//搜索
			var $ = layui.jquery, active = {
				search: function () {
					var type 		= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
						start 		= $('#start').val(),									//时间 - 开始
						end 		= $('#end').val(),										//时间 - 结束
						auth_status = $('#auth_status').val(),								//认证状态
						compliance_type=$("#compliance_type").val(),
						driver_phone= $('#driver_phone').val(),
                        referee_type= $('#referee_type').val(),
					    franchisee_info = $('#franchisee_id').val(),
						confor_status=$("#confor_status").val(),
						work_province=$("#province_id").val(),
						work_city=$("#city_id").val(),
						all_phone	 = $("#all_phone").val();
					table.reload('driver', {
						url: '/admin/Driver/banned', where: {
							"type" : type,
							"start" : start,
							"end" : end,
							"auth_status" : auth_status,
							"compliance_type" : compliance_type,
							"driver_phone" : driver_phone,
							"referee_type" : referee_type,
							"franchisee_info" : franchisee_info,
							"confor_status" : confor_status,
							"all_phone" : all_phone,
							"work_province" : work_province,
							"work_city" : work_city,
						}
					});
				}
                , excel: function () {
                    var type 		= $('#type').val(),										//类型 1登录2注册3在线时长和订单数
                        start 		= $('#start').val(),									//时间 - 开始
                        end 		= $('#end').val(),										//时间 - 结束
                        auth_status = $('#auth_status').val(),								//认证状态
						compliance_type=$("#compliance_type").val(),
                        driver_phone= $('#driver_phone').val(),
                    	referee_type= $('#referee_type').val(),
                    	franchisee_info = $('#franchisee_id').val(),
						confor_status=$("#confor_status").val(),
						all_phone	 = $("#all_phone").val(),
						provinceCity = $("#provinceCity").val(),
						sum_time = $("#sum_time").val();
                    var str = "&type="+ type + "&all_phone="+ all_phone + "&start="
                        + start + "&end=" + end + "&auth_status=" + auth_status+ "&compliance_type="+ compliance_type + "&driver_phone=" + driver_phone + "&referee_type=" + referee_type + "&franchisee_info=" + franchisee_info + "&confor_status=" + confor_status+"&provinceCity"+provinceCity+"&sum_time"+sum_time;
                    layer.confirm('请选择导出内容:', {
                        btn: ['全部数据', '取消'] //可以无限个按钮
                        , btn3: function (index, layero) {
                            layer.close(index);
                        }
                    }, function (index, layero) {
                        //按钮【按钮一】的回调
                        location = "{:url('excel','all=1')}"+str ;
                        layer.close(index);
                    }, function (index) {
//                        location = "{:url('excel','all=2')}" + str+"&page="+_cur_page+"&limit="+_cur_limit;
//                        layer.close(index);
                    });
                }
			};
			$('.layui-btn').on('click', function () {
				var type = $(this).data('type');
				active[type] ? active[type].call(this) : '';
			});

		});
		//选择省市切换
		function getProvinceList(){
			$("#city_id").empty();
			$("#city_id").append('<option value=>请选择城市</option>');
			var province_id = $("#province_id").val();
			$.ajax({
				url:'{:url("/admin/Franchisee/cityList")}',
				async:true,
				//dataType:'json',
				type:'post',
				data:{'province_id':province_id},
				success:function(res){
					$("#city_id").append(res);
				},
				error:function(e){
					layer.msg('请求错误');return false;
				}
			})
		};
	</script>
</block>
